//
//  HLELowcostScheduler.h
//  HLELowcostPeripherial
//
//  Created by hle1 on 2021/5/4.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface HLELowcostScheduler : NSObject
#pragma mark ============ 基础功能开始 ==============
/// 初始化SDK
+ (void)initLowcostDeviceSDK:(NSInteger)appendFlagTimeout normalTimeout:(NSInteger)normalTimeout;

/// 获取序列号
/// @param advertisementData 蓝牙数据
+ (NSString *)getSerialNumWithAdvertisementData:(NSDictionary *)advertisementData;

/// 获取版本号
/// @param advertisementData 蓝牙数据
+ (NSString *)getVersionNumWithAdvertisementData:(NSDictionary *)advertisementData;

/// 是否绑定
/// @param advertisementData 蓝牙数据
+ (BOOL)isUnBindWithAdvertisementData:(NSDictionary *)advertisementData;

/// 低成本蓝牙
/// @param advertisementData 蓝牙数据
+ (BOOL)isLowcostWithAdvertisementData:(NSDictionary *)advertisementData;

/// 低成本蓝牙设备的deviceCode
/// @param advertisementData 蓝牙数据
+ (NSString *)getLowcostDeviceCodeWithAdvertisementData:(NSDictionary *)advertisementData;

/// 解析低成本蓝牙数据
/// @param advertisementData 蓝牙数据
+ (uint8_t *)parseLowcostDataWithAdvertisementData:(NSDictionary *)advertisementData;

/// 连接设备
+ (void)setDeviceConnectBySerialNum:(NSString *)serialNum
                              complete:(void (^)(BOOL isSuccess,NSData *data))complete;

/// 断开设备
/// @param serialNum 
+ (void)setDeviceDisConnectBySerialNum:(NSString *)serialNum
                                 delay:(CGFloat)delay;

/// 断开所有设备
+ (void)cancelAllPeripheralsConnection;

#pragma mark ============ 基础功能结束 ==============

#pragma mark ============ 灯功能开始 ==============



/// 设置设备所属组ID 命令
/// @param deviceCode 设备code
/// @param groupID 组code
/// @param delay 延时停止广播 秒单位
+ (void)setDeviceGroupIDWithDeviceCode:(NSString *)deviceCode
                               groupID:(NSString *)groupID
                                 delay:(CGFloat)delay
                             serialNum:(NSString *)serialNum
                              complete:(void (^)(BOOL isSuccess,NSData *data))complete;

/// 设置单台设备亮灯模式
/// @param deviceCode 设备code
/// @param mode 模式
/// @param colorList 颜色
/// @param isGroup 是组
/// @param delay 延时停止广播 秒单位
+ (void)setDeviceModeWithDeviceCode:(NSString *)deviceCode
                               mode:(NSInteger)mode
                      scene_mode_id:(NSInteger)scene_mode_id
                     RGB_brightness:(NSInteger)RGB_brightness
                          RGB_speed:(NSInteger)RGB_speed
                            RGB_cct:(NSInteger)RGB_cct
                        colorList:(nullable NSArray <UIColor *>*)colorList
                            isGroup:(BOOL)isGroup
                              delay:(CGFloat)delay
                     switching_mode:(NSInteger)switching_mode
                     extra_scene_id:(NSInteger)extra_scene_id
                          deviceCodes:(nullable NSArray <NSString *>*)deviceCodes
                          serialNum:(NSString *)serialNum
                           complete:(nullable void (^)(BOOL isSuccess,NSData *data))complete;

/// 设置设备解散分组 命令
/// @param groupID 组code
/// @param delay 延时停止广播 秒单位
+ (void)setDeviceGroupDissolveWithGroupID:(NSString *)groupID
                                    delay:(CGFloat)delay
                                serialNum:(NSString *)serialNum
                                 complete:(nullable void (^)(BOOL isSuccess,NSData *data))complete;


/// 设置开灯状态
/// @param deviceCode 组code
/// @param isGroup 是组
/// @param mode //模式：0：默认状态；1：上一次开灯状态
/// @param default_RGB //默认RGB颜色值
/// @param default_cw_cct //CW 控制---色温
/// @param default_cw_lum //CW 控制---亮度
+ (void)setDeviceOpenLightStatu:(NSString *)deviceCode
                        isGroup:(BOOL)isGroup
                           mode:(NSInteger)mode
                    default_RGB:(UIColor *)default_RGB
                default_cw_cct:(NSInteger)default_cw_cct
                 default_cw_lum:(NSInteger)default_cw_lum
                          delay:(CGFloat)delay
                      deviceCodes:(nullable NSArray <NSString *>*)deviceCodes
                      serialNum:(NSString *)serialNum
                       complete:(nullable void (^)(BOOL isSuccess,NSData *data))complete;

/// 获取开灯状态
/// @param deviceCode 组code
/// @param isGroup 是组
/// @param delay 延时停止广播 秒单位
/// @param complete complete description
+ (void)getOpenLightStatu:(NSString *)deviceCode
                  isGroup:(BOOL)isGroup
                    delay:(CGFloat)delay
                deviceCodes:(nullable NSArray <NSString *>*)deviceCodes
                serialNum:(NSString *)serialNum
                 complete:(nullable void (^)(BOOL isSuccess,NSData *data))complete;


/// 获取灯模式参数
/// @param deviceCode 组code
/// @param isGroup 是组
/// @param complete complete description
+ (void)getDeviceDynamicMode:(NSString *)deviceCode
                     isGroup:(BOOL)isGroup
                       delay:(CGFloat)delay
                   deviceCodes:(nullable NSArray <NSString *>*)deviceCodes
                   serialNum:(NSString *)serialNum
                    complete:(nullable void (^)(BOOL isSuccess,NSData *data))complete;


/// 绑定广播包
/// @param deviceCode 设备code
/// @param delay delay description
+ (void)setDeviceBind:(NSString *)deviceCode
                delay:(CGFloat)delay
            serialNum:(NSString *)serialNum
             complete:(nullable void (^)(BOOL isSuccess,NSData *data))complete;
/// 复位广播包
/// @param deviceCode 设备code
/// @param delay delay description
+ (void)setDeviceReset:(NSString *)deviceCode
                 delay:(CGFloat)delay
             serialNum:(NSString *)serialNum
              complete:(nullable void (^)(BOOL isSuccess,NSData *data))complete;

/// 不单独定义配置读取命令，设置命令会返回当前设备参数
//uint16_t nodeCount;        // 设为0xffff不会修改配置
//uint8_t rgbSeq;            // 设为0xff不会修改配置
//uint8_t protocol;        // 设为0xff不会修改配置
+ (void)setDeviceMarQuee:(NSString *)deviceCode
               nodeCount:(NSInteger)nodeCount
                  rgbSeq:(NSInteger)rgbSeq
                protocol:(NSInteger)protocol
                   delay:(CGFloat)delay
               serialNum:(NSString *)serialNum
                complete:(nullable void (^)(BOOL isSuccess,NSData *data))complete;

#pragma mark ============ 灯功能结束 ==============


#pragma mark ============ 倒计时开始 ==============
/// 设置单台/组设备倒计时任务
/// @param deviceCode 设备code
/// @param isGroup 组code
/// @param countDown 到时间
/// @param action 倒计时时间结束后要执行的动作（0：关；1：开）
/// @param complete 回调
+ (void)setDeviceCountDown:(NSString *)deviceCode
                   isGroup:(BOOL)isGroup
                    countDown:(NSInteger)countDown
                    action:(NSInteger)action
                     delay:(CGFloat)delay
                 deviceCodes:(nullable NSArray <NSString *>*)deviceCodes
                 serialNum:(NSString *)serialNum
                  complete:(nullable void (^)(BOOL isSuccess,NSData *data))complete;


/// 获取单台/组设备倒计时任务
/// @param deviceCode 设备code
/// @param isGroup 组code
/// @param delay delay description
/// @param complete complete description
+ (void)getDeviceCountDown:(NSString *)deviceCode
                    isGroup:(BOOL)isGroup
                     delay:(CGFloat)delay
                 deviceCodes:(nullable NSArray <NSString *>*)deviceCodes
                 serialNum:(NSString *)serialNum
                  complete:(nullable void (^)(BOOL isSuccess,NSData *data))complete;


/// 设置系统时间
/// @param deviceCode 设备code
/// @param isGroup 组code
/// @param delay delay description
/// @param timestamp timestamp description
/// @param complete complete description
+ (void)setDeviceTime:(NSString *)deviceCode
              isGroup:(BOOL)isGroup
                delay:(CGFloat)delay
            timestamp:(NSInteger)timestamp
            deviceCodes:(nullable NSArray <NSString *>*)deviceCodes
            serialNum:(NSString *)serialNum
             complete:(nullable void (^)(BOOL isSuccess,NSData *data))complete;

#pragma mark ============ 倒计时结束 ==============



#pragma mark ============ 定时器开始 ==============

/// 设置单台/组设备定时任务命令
/// @param deviceCode 设备code
/// @param isGroup 组code
/// @param start start description
/// @param end end description
/// @param delay delay description
/// @param complete complete description
+ (void)setDeviceTiming:(NSString *)deviceCode
                isGroup:(BOOL)isGroup
                 taskID:(NSInteger)taskID
                  state:(NSInteger)state
                   mode:(NSInteger)mode
                 repeat:(NSInteger)repeat
                 action:(NSInteger)action
                  start:(NSInteger)start
                    end:(NSInteger)end
                  delay:(CGFloat)delay
              deviceCodes:(nullable NSArray <NSString *>*)deviceCodes
              serialNum:(NSString *)serialNum
               complete:(nullable void (^)(BOOL isSuccess,NSData *data))complete;


/// 获取定时器
/// @param deviceCode 设备code
/// @param isGroup 组code
/// @param delay delay description
/// @param complete complete description
+ (void)getDeviceTiming:(NSString *)deviceCode
                isGroup:(BOOL)isGroup
                  delay:(CGFloat)delay
              deviceCodes:(nullable NSArray <NSString *>*)deviceCodes
              serialNum:(NSString *)serialNum
               complete:(nullable void (^)(BOOL isSuccess,id data))complete;
#pragma mark ============ 定时器结束 ==============

/// 取消队列的所有操作
+ (void)cancelAllOperations;

+ (void)HLELowcostPeripherialLogMsg:(unsigned char *)payload serialNum:(NSString *)serialNum;
@end

NS_ASSUME_NONNULL_END
